<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #box {
            height: 300px;
            width: 300px;
            font-size: 20px;
        }
        
        .html-content {
            background-color: pink;
        }
        
        .css-contents {
            background-color: greenyellow;
        }
        
        .js-contents {
            background-color: gold;
        }
        
        .vuejs-content {
            background-color: chocolate;
        }
    </style>
</head>

<body>
    <div id="app">
        <button v-for="(item,index) in title" v-on:click="add(index)">
            {{item.item}}
        </button>
        <div id="box" v-bind:class="del">{{del}}</div>
    </div>
    <script src="./vue.js"></script>
    <script>
        let vm = new Vue({
            el: '#app',
            data: {
                index: 0,
                title: [{
                    item: 'html'
                }, {
                    item: 'css'
                }, {
                    item: 'js'
                }, {
                    item: 'vue.js'
                }],
                contents: [{
                    item: 'html-content'
                }, {
                    item: 'css-contents'
                }, {
                    item: 'js-contents'
                }, {
                    item: 'vuejs-content'
                }]
            },
            methods: {
                add(index) {
                    this.index = index
                }
            },
            computed: {
                del() {
                    return this.contents[this.index].item
                }
            }
        })
    </script>
</body>

</html>